package com.sihan.framework.etm.mapper.business;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.sihan.framework.etm.dto.AtlasAnswerDTO;
import com.sihan.framework.etm.dto.TicketLIstDTO;
import com.sihan.framework.etm.dto.business.AtlasPositionDTO;
import com.sihan.framework.etm.vo.business.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.framework.mybatis.mapper.BaseMapper;
import com.sihan.framework.etm.dto.baseData.DevicePostionDTO;
import com.sihan.framework.etm.dto.baseData.ToolDTO;
import com.sihan.framework.etm.dto.business.ToolPositonDTO;
import com.sihan.framework.etm.dto.business.WarehouseQueryReqDTO;
import com.sihan.framework.etm.entity.business.ToolPosition;
import com.sihan.framework.etm.vo.baseData.DeviceBindRecordVO;
import com.sihan.framework.etm.vo.baseData.DevicePositionVO;

@Mapper
public interface ToolPositionMapper extends BaseMapper<ToolPosition, String> {


	ToolPositionDetailVO selectToolCoordinateInfoById(@Param("id") String id);

	List<ToolPositionDetailVO> selectPage(@Param("param") ToolPositonDTO dto);

	List<DevicePositionVO> selectDeviceCoordinateForMap(@Param("param") DevicePostionDTO dto, @Param("orgIds") String[] orgIds);


	List<ToolNewTrajectoryVO> selectDeviceCoordinateFor(@Param("orgIds") String[] orgIds,
                                                        @Param("deviceId") String deviceId,
                                                        @Param("deviceName") String deviceName,
														@Param("taskCode") String taskCode,
                                                        @Param("deviceCode") String deviceCode,
                                                        @Param("deviceType") String deviceType,
                                                        @Param("starTTime") Date starTTime,
                                                        @Param("endTime") Date endTime);

	List<TicketLIstDTO> selectTicketLIst(@Param("orgIds") String[] orgIds,
										 @Param("deviceId") String deviceId,
										 @Param("deviceName") String deviceName,
										 @Param("taskCode") String taskCode,
										 @Param("deviceCode") String deviceCode,
										 @Param("deviceType") String deviceType,
										 @Param("starTTime") Date starTTime,
										 @Param("endTime") Date endTime);


	List<AtlasAnswerDTO> selectAtlasLIst(@Param("ids")List<String> ids, @Param("dto")AtlasPositionDTO dto,@Param("orgIds") String[] orgIds);



	/**
	 * 根据坐标判断设备是否在圈定的多边形范围内
	 *
	 * @param orgIds
	 * @return
	 */
	List<String> selectAtlasIds(@Param("orgIds") String[] orgIds,@Param("polygon")String polygon);

	List<LocalizerVO> wxMap(@Param("orgIds") String[] orgIds,@Param("query") String query);

	List<ToolWarehouseRecordVO> selectWarehouseRecord(@Param("param") WarehouseQueryReqDTO dto);

	List<ToolTrajectoryVO> selectToolCoorHistory(@Param("param") ToolDTO dto,
												 @Param("dropDistances") Integer dropDistances,
												 @Param("pickInterval") Integer pickInterval);

	Integer hasPosition(@Param("deviceId")String deviceId,
						@Param("startTime")Date startTime,
						@Param("endTime")Date endTime,
						@Param("type")String type);



	List<WXCoordinateVO> getWXCoordinateList(@Param("param") ToolDTO dto,
											 @Param("dropDistances") Integer dropDistances,
											 @Param("pickInterval") Integer pickInterval);


	int addToolPositionRecord(Map<?, ?> jsonObject);

	List<DeviceBindRecordVO> selectDeviceBindRecord(@Param("param") DevicePostionDTO dto);
}
